<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TP Code Generator - by xinqiyang</title>
<link href="__TMPL__css/tools.css" rel="stylesheet" type="text/css" /> 

<script src="__TMPL__js/jquery.min.js" type="text/javascript"></script>
<script>   
$(document).ready(function(){
    $("#build").click(function() {
		$.ajax({
		   type: "POST",
		   url: "__URL__/returnr",
		   data: $('#dbg').serialize(),
		   success: function(msg){
			 $("#result").html(msg);
		     //alert( "Data Saved: " + msg );
		     $("#result").focus();
		   }
		});
   });
   $("#baction").click(function() {
		$.ajax({
		   type: "POST",
		   url: "__URL__/returna",
		   data: $('#dbg').serialize(),
		   success: function(msg){
			 $("#result").html(msg);
		     //alert( "Data Saved: " + msg );
		     $("#result").focus();
		   }
		});
   });
   $("#mbuild").click(function() {
		$.ajax({
		   type: "POST",
		   url: "__URL__/returnm",
		   data: $('#dbg').serialize(),
		   success: function(msg){
			 $("#result").html(msg);
		     //alert( "Data Saved: " + msg );
		     $("#result").focus();
		   }
		});
   });
});


function checkaction(v){ 
	if(v==0){ 
		tourl="__URL__/returnm";
	}else{ 
		tourl="__URL__/returna"; 
	} 
	this.click(function() {
		$.ajax({
		   type: "POST",
		   url: "__URL__/returnm",
		   data: $('#dbg').serialize(),
		   success: function(msg){
			 $("#result").html(msg);
		     //alert( "Data Saved: " + msg );
		     $("#result").focus();
		   }
		});
   });
	//dbform.submit();
	alert(tourl); 
} 

</script>
</head>
<body>
<div class="mainpage">
<h1>TP Code Generator -- by xinqiyang</h1>

<div class="pleft">
	
		<h2>生成结果</h2>
<textarea id="result" rows="30" cols="100" style="background-color:#ffcc00;"></textarea>
		
	    

</div>

<div class="pright">
	<h2>操作面板内容<a style="margin-left:10px;" href="__URL__" style="color:black">刷新生成器</a> <a href="__ROOT__/index.php/test" target="_blank">测试内容</a> <a href="__ROOT__/index.php/test/test" target="_blank">测试2</a> </h2>
	
	
	<h2>项目模块信息  当前模块  <a style="margin-left:20px;" id="baction" href="javascript:void()">生成ACTION代码</a></h2>

	<form action="__URL__/index" method="post">
	
	当前表<span style="color:red;">{$dbname}</span>
		<select id="mn" name="mn">
			<volist name="dbtable" id="tb">
			<option value="{$tb}">{$tb}</option>
			</volist>
		</select>
		<input type="submit" name="tabname" value="提交选定表" />
	</form>
	<br />
	<h2>数据表字段信息   <a style="margin-left:20px;" id="build" href="javascript:void()">FORM代码</a>
	<a style="margin-left:10px;" id="mbuild" href="javascript:void()">MODEL代码</a>
	</h2>
	<div id="db">
   
   <form id="dbg" name="dbg" action="__URL__/returnr" method="post" >
   <h2>数据库操作 <input type="radio" name="orp" value="1" />Add <input type="radio" name="orp" value="2" />Update <input type="radio" name="orp" value="3" />All </h2> 
	
   	<input type="radio" name="tt" value="list" />列表 <input type="radio" name="tt" value="add" />添加 <input type="radio" name="tt" value="edit" checked />编辑   <input style="padding-left:10px;" type="checkbox" name="adminc" checked />后台编辑 <br /> 
    <input type="hidden" value="{$dbname}" name="dbtable" />
	<volist name="var" id="f">
	  <ul>
	   <li>
	   <span  name="Field">{$f.Field}</span>
	   <span  name="Comment">{$f.Comment|default='null'}</span>	   
		   <select  name="c{$f.Field}">
		   	   <option value="none">NONE</option>
		   	   <option value="input">INPUT</option>
		   	   <option value="select">SELECT</option>
		   	   <option value="radio" >RADIO</option>
		   	   <option value="textarea" >TextArea</option>
		   	   <option value="show" >Show</option>
		   	   <option value="view" >view</option>
		   	     <option value="auto" >Auto</option>
		   </select> 
	    </li>
	   </ul>
	</volist>
	
	</form>
	</div>	
	
</div>

</div>
<div class="clear" />
</body>
</html>
